package cc.yugu.yhdw.webserver.persistence.hdw;

import cc.yugu.yhdw.common.domain.hdw.ExchangePacketOrder;
import cc.yugu.yhdw.common.persistence.MasterMapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
/**
 * 换点套餐订单表信息
 * 
 * @Date:Created in 2018/6/30 16:20
 * @Author:
 * @Modified By: zjn 2018/6/30 16:20
 */ 
public interface ExchangePacketOrderMapper extends MasterMapper {
    /**
    * 查询表hdw_exchange_packet_order，返回行数
    *
    * @Param: [packetPeriodOrder]
    * @Return: int
    * @Author By: zjn 2018/6/30  16:20
    */
    int findPageCount(ExchangePacketOrder packetPeriodOrder);
    /**
     * 查询表hdw_exchange_packet_order数量（ add field agency_id)
     * @Param [packetPeriodOrder]
     * @Return int
     * @Author zxj 2018/7/31
     */
    int findPageCounts(ExchangePacketOrder packetPeriodOrder);
    
    /**
    * 分页查询，并将查询结果按照创建时间降序排列
    *
    * @Param: [packetPeriodOrder]
    * @Return: java.util.List
    * @Author By: zjn 2018/6/30  16:21
    */
    List<ExchangePacketOrder> findPageResult(ExchangePacketOrder packetPeriodOrder);
    /**
     * 分页查询，并将查询结果按照创建时间降序排列(add field agency_id)
     * @Param [packetPeriodOrder]
     * @Return java.util.List
     * @Author zxj 2018/7/31
     */
    List<ExchangePacketOrder> findPageResults(ExchangePacketOrder packetPeriodOrder);
    /**
    * 根据主键查询
    *
    * @Param: [id]
    * @Return: cc.yugu.yhdw.common.domain.hdw.ExchangePacketOrder
    * @Author By: zjn 2018/6/30  16:21
    */
    ExchangePacketOrder find(String id);
    /**
    * 根据主键更新 剩余次数
    *
    * @Param: [id]
    * @Return: int
    * @Author By: zjn 2018/6/30  16:21
    */
    public int updateSurplusNumber(@Param("id") String id);
    /**
    * 根据订单状态和主键更新
    *
    * @Param: [fromStatus, toStatus, expireTime, id]
    * @Return: int
    * @Author By: zjn 2018/6/30  16:21
    */
    public int updateExpiredOrder(@Param("fromStatus")int fromStatus, @Param("toStatus")int toStatus, @Param("expireTime")Date expireTime, @Param("id") String id);

}
